home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / (A)U / (A)U5.ADF / VTrap / VirusTrap.c < prev   
C/C++ Source or Header  |  1989-01-02  |  2KB  |  61 lines

  1. /********************************************************************
  2. **
  3. **    VirusTrap.c
  4. **
  5. **    (c) 1988 Eduardo Horvath
  6. **
  7. **    All Rights Reserved
  8. **
  9. **      Permission to copy and distribute free of charge
  10. **
  11. ********************************************************************/ 
  12.  
  13. #include <exec/memory.h>
  14. #include <libraries/dos.h>
  15. #include <functions.h>
  16.  
  17. /*******************************************************************
  18.  
  19.    This program checks its own size and reports any changes.
  20.  
  21.    It should be placed in the first line of s:Startup-Sequence.
  22.  
  23. ********************************************************************/
  24.  
  25. /*   This was compiled under Aztec C v3.04.  The program size will
  26.        vary according to compiler.  Compile the program, find its
  27.        size, and then replace PROGSIZ.
  28. */
  29. #define PROGSIZ        5216L
  30.  
  31.  
  32. struct FileInfoBlock *fib = NULL, FileInfoBlock[3];
  33.  
  34. struct FileLock *lock = NULL;
  35.  
  36.  
  37. main(argc, argv)
  38. int argc;
  39. char *argv[];
  40. {
  41. int i;
  42.  
  43. /* Put a lock on this executable file (is stored in argv[0]) */
  44.    lock = Lock(argv[0], ACCESS_READ );
  45.  
  46.    if(!lock) return(0);
  47.  
  48. /* Longword Align fib (don't alter mem lists) */
  49.    fib = ((long) &FileInfoBlock[1]) & 0xfffffffc;
  50.  
  51.    if( !Examine(lock,fib) ) Exit( printf( "Unsuccessful Examine().\n") );;
  52.  
  53.    if( fib->fib_Size != PROGSIZ )
  54.      printf("Original File Length = %ld\n\
  55.              Current File Length = %ld\n\n\
  56.              WARNING:  POSSIBLE VIRAL INFECTION!!!\n",
  57.              PROGSIZ, fib->fib_Size );
  58.  
  59.    UnLock( lock );
  60. }
  61.